import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:fish_redux/fish_redux.dart';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'action.dart';
import 'state.dart';

Reducer<StoreDetailViewState> buildReducer() {
  return asReducer(
    <Object, Reducer<StoreDetailViewState>>{
      StoreDetailViewAction.action: _onAction,
      StoreDetailViewAction.onGetData: _onGetData,
    },
  );
}

StoreDetailViewState _onAction(StoreDetailViewState state, Action action) {
  final StoreDetailViewState newState = state.clone();
  return newState;
}

StoreDetailViewState _onGetData(StoreDetailViewState state, Action action) {
  final StoreDetailViewState newState = state.clone();
  if (action.payload['model'] != null) newState.models = action.payload['model'];
  return newState;
}
